<include file="public@header" />
</head>
<body >
	<div class="wrap ">
		<ul class="nav nav-tabs">
			<li><a href="{:url('goods/index',array('type'=>$type))}">{$goods_name_menu}</a></li>
			<li class="active"><a href="{:url('goods/add',array('type'=>$type))}">{$goods_name_add}</a></li>
		</ul>
		<form class="form-horizontal js-ajax-form" action="{:url('Goods/add_post')}" method="post" enctype="multipart/form-data">
			<input type="hidden" name="type" value="{$type}" />
            <fieldset>
				<if condition="$type eq 1">
					<div class="control-group">
						<label class="control-label">物料编号</label>
						<div class="controls">
							<input type="text" class="form-control" name="goods_num" value="{$goods_num}" id="goods_num" readonly/>
						</div>
					</div>
				</if>
				<div class="control-group">
					<label class="control-label">{:lang('GOODS_NAME')}</label>
					<div class="controls">
						<input type="text" class="form-control" name="goods_name" value="" id="goods_name" required/>
						<span class="form-required">*</span>
					</div>
				</div>
                <div class="control-group">
					<label class="control-label">{:lang('GOODS_CATE')}</label>
					<div class="controls">
                    	<select class="form-control" <if condition="$type neq null">readonly name="type"<else/>name="cate_p_id"</if>>
							<if condition="$type neq null">
								<option value="2" <if condition="$type eq 2">selected</if>>固定资产</option>
								<option value="1" <if condition="$type eq 1">selected</if>>物料</option>
							<else/>
								<volist name="cates" id="vo">
									<option value="{$vo.id}">{$vo.cate_name}</option>
								</volist>
							</if>
                        </select>
					</div>
				</div>
                <div class="control-group normal">
					<label class="control-label">{:lang('PRICE')}</label>
					<div class="controls">
						<input type="text" class="form-control" name="price" value="" id="price" required/>
						<span class="form-required">*</span>
					</div>
				</div>
				<if condition="$type eq 1">
					<div class="control-group">
						<label class="control-label">单位</label>
						<div class="controls">
							<input :type="text" class="form-control" name="price_unit" value="" required/>
							<span class="form-required">*</span>
						</div>
					</div>
				</if>
				<if condition="$type neq ''">
                <div class="control-group">
					<label class="control-label">{:lang('STOREROOM')}</label>
					<div class="controls">
                    	<select name="room" class="form-control">
							<volist name="rooms" id="vo">
                                <option value="{$vo.id}">{$vo.room_name}</option>
                            </volist>
						</select>
					</div>
				</div>
				</if>
				<if condition="$type neq 1">
				<div class="control-group">
					<label class="control-label">{:lang('NUM')}</label>
					<div class="controls">
						<input type="text" class="form-control" name="stock" value="" id="stock" required/>
                        <span class="form-required">*</span>
					</div>
				</div>
				</if>
                <div class="control-group">
					<label class="control-label">{:lang('SUPPLIER')}</label>
					<div class="controls">
						<input type="text" class="form-control" name="service" value=""/>
					</div>
				</div>
                <div class="control-group">
					<label class="control-label">排序</label>
					<div class="controls">
						<input type="text" class="form-control" name="listorder" value="255" required/>
                        <span class="form-required">商品默认升序排序</span>
					</div>
				</div>
				<if condition="$type neq 1">
                <div class="control-group">
					<label class="control-label">{:lang('封面图片')}</label>
					<div class="controls">
                        <input type="hidden" name="photos_url" id="photos_url" value="">
                        <img height="36" src="" class="preview isHide" id="photos_url-preview" />
						<a class="btn btn-primary" onClick="uploadOneImage('商品图片', '#photos_url')">{:lang("UPLOAD")}</a>
						<span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">{:lang('IF_SHOW')}</label>
					<div class="controls">
						<input type="radio" name="if_show" value="1" checked>是
						<input type="radio" name="if_show" value="0"> 否
					</div>
				</div>
				</if>
				<div class="control-group">
					<label class="control-label">{:lang('商品描述')}</label>
					<div class="controls">
						<textarea name="description" class="form-control" style="width:400px;height:100px;"/></textarea>
					</div>
				</div>

			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
				<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
			</div>
		</form>
	</div>
    <admintpl file="Goods/include"/>
	<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
	<script type="text/javascript">
        $("#btn").click(function(){
            upload_one("视频上传", "#video_path", "video");
        });
		
    </script>
</body>
</html>